HAL1 CRYP –> HAL2 CRYP

This section provides information about the HAL CRYP constants migration.

Error code

HAL1

HAL2

#define HAL_CRYP_ERROR_NONE
#define HAL_CRYP_ERROR_NONE
#define HAL_CRYP_DMA_ERROR
/* or  */
#define HAL_CRYP_ERROR_DMA
#define HAL_CRYP_ERROR_DMA
#define HAL_CRYP_ERROR_KEY
#define HAL_CRYP_ERROR_KEY
#define HAL_CRYP_BUSY_ERROR
#define HAL_CRYP_ERROR_BUSY
#define HAL_CRYP_ERROR_TIMEOUT
#define HAL_CRYP_ERROR_NOT_SUPPORTED
#define HAL_CRYP_ERROR_AUTH_TAG_SEQUENCE
#define HAL_CRYP_ERROR_INVALID_CALLBACK
  • Removed; These kinds of logical errors are reported by the direct function return.


Algorithm / chaining mode

HAL1

HAL2

#define  CRYP_CHAINMODE_AES_ECB
#define  CRYP_AES_ECB
#define  CRYP_DES_ECB
#define  CRYP_TDES_ECB
#define  CRYP_CHAINMODE_AES_CBC
#define  CRYP_AES_CBC
#define  CRYP_DES_CBC
#define  CRYP_TDES_CBC
#define  CRYP_CHAINMODE_AES_CTR
#define  CRYP_AES_CTR
#define  CRYP_CHAINMODE_AES_GCM_GMAC
#define  CRYP_AES_GCM_GMAC
#define  CRYP_AES_GCM
#define  CRYP_CHAINMODE_AES_CCM
#define  CRYP_AES_CCM
#define  CRYP_CHAINMODE_AES_CMAC
  • Removed; In HAL2 the global configuration has been split into one configuration function per algorithm, eliminating the need to explicitly specify the algorithm.


DMA input phase management constants

HAL1

HAL2

#define  CRYP_DMAIN_ENABLE
#define  CRYP_DMAOUT_ENABLE
#define  CRYP_DMAOUT_DISABLE
#define  CRYP_DMAIN_DISABLE
  • Removed; In HAL2 , DMA input phase management is handled internally.


GCM/GMAC and CCM/CMAC processing phase constants

HAL1

HAL2

#define CRYP_GCM_INIT_PHASE
#define CRYP_GCMCMAC_HEADER_PHASE
#define CRYP_GCM_PAYLOAD_PHASE
#define CRYP_GCMCMAC_FINAL_PHASE
#define CRYP_INIT_PHASE
#define CRYP_HEADER_PHASE
#define CRYP_PAYLOAD_PHASE
#define CRYP_FINAL_PHASE
  • Removed; In HAL2 the processing phases have been removed from the global configuration function and are now handled internally.


Enable state constants

HAL1

HAL2

#define CRYP_AES_DISABLE
#define CRYP_AES_ENABLE
  • Removed; In HAL2 the state constants are used internally.


Operating mode constants

HAL1

HAL2

#define CRYP_ALGOMODE_ENCRYPT
#define CRYP_ALGOMODE_KEYDERIVATION
#define CRYP_ALGOMODE_DECRYPT
#define CRYP_ALGOMODE_KEYDERIVATION_DECRYPT
#define CRYP_ALGOMODE_TAG_GENERATION
  • Removed; In HAL2 all operating mode constants have been removed from the global configuration function and are now set directly within the encryption and decryption functions.


Key and init vector configuration skip mode constants

HAL1

HAL2

#define CRYP_KEYIVCONFIG_ALWAYS
#define CRYP_KEYIVCONFIG_ONCE
#define CRYP_KEYNOCONFIG
#define CRYP_IVCONFIG_ONCE
  • Removed; In in HAL2 the AES key is no longer part of the global configuration function.Instead, it is provided when calling HAL_AES_SetNormalKey(), HAL_AES_SetSharedKey(), or HAL_AES_SetHWKey().Likewise, the initialization vector has been removed from the global configuration and is now supplied through the dedicated configuration functions.


CRYP key share ID constant

HAL1

HAL2

#define CRYP_KSHAREID_AES

In HAL2, this constant is removed. It was used internally in HAL1 and did not affect user-level operations.


Data width unit constants

HAL1

HAL2

#define CRYP_DATAWIDTHUNIT_WORD
#define CRYP_DATAWIDTHUNIT_BYTE
  • Removed; In HAL2 all process functions use byte-sized data, and the data width has therefore been removed from the global configuration.


Header width unit constants

HAL1

HAL2

#define CRYP_HEADERWIDTHUNIT_WORD
#define CRYP_HEADERWIDTHUNIT_BYTE
  • Removed; In HAL2, the header size used in configuration functions is expressed in bytes, and the header width has therefore been removed from the global configuration.


Clear flags constants

HAL1

HAL2

#define CRYP_CLEAR_KEIF
  • Removed; Clear-flag constants have been removed and replaced with dedicated static inline functions for clearing each flag, which are now documented in HAL CRYP Macros section.


Key size constants

HAL1

HAL2

#define CRYP_KEYSIZE_128B
#define CRYP_KEYSIZE_192B
#define CRYP_KEYSIZE_256B
#define HAL_CRYP_KEY_SIZE_128BIT
#define HAL_CRYP_KEY_SIZE_192BIT
#define HAL_CRYP_KEY_SIZE_256BIT

Flags constants

HAL1

HAL2

#define CRYP_FLAG_IFEM
#define CRYP_FLAG_IFNF
#define CRYP_FLAG_OFNE
#define CRYP_FLAG_OFFU
#define CRYP_FLAG_OUTRIS
#define CRYP_FLAG_INRIS
#define CRYP_FLAG_BUSY
#define CRYP_FLAG_KEYVALID
#define HAL_CRYP_FLAG_IFEM
#define HAL_CRYP_FLAG_IFNF
#define HAL_CRYP_FLAG_OFNE
#define HAL_CRYP_FLAG_OFFU
#define HAL_CRYP_FLAG_OUTRIS
#define HAL_CRYP_FLAG_INRIS
#define HAL_CRYP_FLAG_BUSY
#define HAL_CRYP_FLAG_KEYVALID

Interrupts flags constants

HAL1

HAL2

#define CRYP_IT_INI
#define CRYP_IT_OUTI
#define HAL_CRYP_IT_INI
#define HAL_CRYP_IT_OUTI

Data type constants

HAL1

HAL2

#define CRYP_DATATYPE_32B
/* or  */
#define CRYP_NO_SWAP
#define HAL_CRYP_DATA_SWAPPING_NO
#define CRYP_DATATYPE_16B
/* or  */
#define CRYP_HALFWORD_SWAP
#define HAL_CRYP_DATA_SWAPPING_HALFWORD
#define CRYP_DATATYPE_8B
/* or  */
#define CRYP_BYTE_SWAP
#define HAL_CRYP_DATA_SWAPPING_BYTE
#define CRYP_DATATYPE_1B
/* or  */
#define CRYP_BIT_SWAP
#define HAL_CRYP_DATA_SWAPPING_BIT